/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package thinkinginjava.svn.typeinformation;

import java.util.ArrayList;
import java.util.List;
import java.util.logging.Level;
import java.util.logging.Logger;

/**
 *
 * @author public_enemy
 */
public class ForNameCreator extends PetCreator {

    private static List<Class<? extends Pet>> types =
            new ArrayList<Class<? extends Pet>>();
    private static String[] typeNames = {
        "thinkinginjava.svn.typeinformation.Mutt",
        "thinkinginjava.svn.typeinformation.Pug",
        "thinkinginjava.svn.typeinformation.EgyptianMau",
        "thinkinginjava.svn.typeinformation.Manx",
        "thinkinginjava.svn.typeinformation.Cymric",
        "thinkinginjava.svn.typeinformation.Rat",
        "thinkinginjava.svn.typeinformation.Mouse",
        "thinkinginjava.svn.typeinformation.Hamster"
    };

    @SuppressWarnings({"unchecked", "unchecked"})
    private static void loader() {
        for (String name : typeNames) {
            try {
                types.add(
                        (Class<? extends Pet>) Class.forName(name));
            } catch (ClassNotFoundException ex) {
                Logger.getLogger(ForNameCreator.class.getName()).log(Level.SEVERE, null, ex);
            }
        }
    }

    static {
        loader();
    }

    @Override
    public List<Class<? extends Pet>> types() {
        return types;
    }
}
